import Vue from 'vue'
import Vuex from 'vuex'
// 引入自定义主题文件
import autoThemeFun from "../utils/autoThemes.js"

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        // echarts自定义主题
        themeName: "dark",//黑白切换
        // 和echarts配套的自定义主题
        autoTheme:autoThemeFun('dark')//{bg,title,img}
    },
    mutations: {
        // 修改主题
        changeThemes(state) {
            state.themeName = state.themeName == 'dark' ? 'vintage' :"dark"
            state.autoTheme = autoThemeFun(state.themeName)
        }
    }
})